package net.betou.cms.manager.main.impl;

import net.betou.cms.dao.main.ContentCheckDao;
import net.betou.cms.entity.main.Content;
import net.betou.cms.entity.main.ContentCheck;
import net.betou.cms.manager.main.ContentCheckMng;
import net.betou.common.hibernate3.Updater;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ContentCheckMngImpl implements ContentCheckMng{
	public ContentCheck save( ContentCheck check, Content content ) {
		check.setContent( content );
		check.init( );
		dao.save( check );
		content.setContentCheck( check );
		return check;
	}

	public ContentCheck update( ContentCheck bean ) {
		Updater< ContentCheck > updater = new Updater< ContentCheck >( bean );
		bean = dao.updateByUpdater( updater );
		return bean;
	}

	private ContentCheckDao dao;

	@Autowired
	public void setDao( ContentCheckDao dao ) {
		this.dao = dao;
	}
}